home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Include / GuiCombo.au3 < prev    next >
Encoding:
Text File  |  2007-09-08  |  51.9 KB  |  1,054 lines

  1. #include-once
  2. #include <ComboConstants.au3> ; needed for _GUICtrlComboAddDir
  3. #include <Misc.au3>
  4. ; ------------------------------------------------------------------------------
  5. ;
  6. ; AutoIt Version: 3.2.3++
  7. ; Language:       English
  8. ; Description:    Functions that assist with ComboBox.
  9. ;
  10. ; ------------------------------------------------------------------------------
  11.  
  12.  
  13. ; function list
  14. ;===============================================================================
  15. ; _GUICtrlComboAddDir
  16. ; _GUICtrlComboAddString
  17. ; _GUICtrlComboDeleteString
  18. ; _GUICtrlComboFindString
  19. ; _GUICtrlComboGetCount
  20. ; _GUICtrlComboGetCurSel
  21. ; _GUICtrlComboGetDroppedControlRECT
  22. ; _GUICtrlComboGetDroppedState
  23. ; _GUICtrlComboGetDroppedWidth
  24. ; _GUICtrlComboGetEditSel
  25. ; _GUICtrlComboGetExtendedUI
  26. ; _GUICtrlComboGetHorizontalExtent
  27. ; _GUICtrlComboGetItemHeight
  28. ; _GUICtrlComboGetLBText
  29. ; _GUICtrlComboGetLBTextLen
  30. ; _GUICtrlComboGetLocale
  31. ; _GUICtrlComboGetMinVisible
  32. ; _GUICtrlComboGetTopIndex
  33. ; _GUICtrlComboInitStorage
  34. ; _GUICtrlComboInsertString
  35. ; _GUICtrlComboLimitText
  36. ; _GUICtrlComboResetContent
  37. ; _GUICtrlComboSelectString
  38. ; _GUICtrlComboSetCurSel
  39. ; _GUICtrlComboSetDroppedWidth
  40. ; _GUICtrlComboSetEditSel
  41. ; _GUICtrlComboSetExtendedUI
  42. ; _GUICtrlComboSetHorizontalExtent
  43. ; _GUICtrlComboSetItemHeight
  44. ; _GUICtrlComboSetMinVisible
  45. ; _GUICtrlComboSetTopIndex
  46. ; _GUICtrlComboShowDropDown
  47. ;
  48. ; ************** TODO ******************
  49. ; _GUICtrlComboGetComboBoxInfo
  50. ;===============================================================================
  51.  
  52. ;===============================================================================
  53. ;
  54. ; Description:            _GUICtrlComboAddDir
  55. ; Parameter(s):        $h_combobox - control id
  56. ;                            $s_Attributes - Comma-delimited string
  57. ;                            $s_file - Optional for "Drives" only: what to get i.e *.*
  58. ; Requirement:            None
  59. ; Return Value(s):    zero-based index of the last name added to the list
  60. ;                            If an error occurs, the return value is $CB_ERR.
  61. ;                            If there is insufficient space to store the new strings, the return value is $CB_ERRSPACE
  62. ; User CallTip:        _GUICtrlComboAddDir($h_combobox, $s_Attributes[, $s_file=""]) Add names to the list displayed by the combo box (required: <GuiCombo.au3>)
  63. ; Author(s):            Gary Frost (custompcs at charter dot net)
  64. ; Note(s):                $s_Attributes is an comma-delimited string
  65. ;                             valid values are any of the following:
  66. ;                                 A,D,H,RO,RW,S,E,Drives,NB
  67. ;                            A = ARCHIVE
  68. ;                                Includes archived files.
  69. ;                            D = DIRECTORY
  70. ;                                Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
  71. ;                            H = HIDDEN
  72. ;                                Includes hidden files.
  73. ;                            RO = READONLY
  74. ;                                Includes read-only files.
  75. ;                            RW = READWRITE
  76. ;                                Includes read-write files with no additional attributes. This is the default setting.
  77. ;                            S = SYSTEM
  78. ;                                Includes system files.
  79. ;                            E = EXCLUSIVE
  80. ;                                Includes only files with the specified attributes. By default, read-write files are listed even if READWRITE is not specified.
  81. ;                            DRIVES
  82. ;                                All mapped drives are added to the list. Drives are listed in the form [-x-], where x is the drive letter.
  83. ;                            NB = No Brackets
  84. ;                               Drives are liste in the form x:, where x is the drive letter (used with Drives attribute)
  85. ;
  86. ;===============================================================================
  87. Func _GUICtrlComboAddDir($h_combobox, $s_Attributes, $s_file = "")
  88.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  89.     Local $i, $v_Attributes = "", $i_drives = 0, $no_brackets = 0
  90.     Local $v_ret, $a_Attributes = StringSplit($s_Attributes, ",")
  91.     For $i = 1 To $a_Attributes[0]
  92.         Select
  93.             Case StringUpper($a_Attributes[$i]) = "A"
  94.                 If (StringLen($v_Attributes) > 0) Then
  95.                     $v_Attributes = $v_Attributes + $CB_DDL_ARCHIVE
  96.                 Else
  97.                     $v_Attributes = $CB_DDL_ARCHIVE
  98.                 EndIf
  99.             Case StringUpper($a_Attributes[$i]) = "D"
  100.                 If (StringLen($v_Attributes) > 0) Then
  101.                     $v_Attributes = $v_Attributes + $CB_DDL_DIRECTORY
  102.                 Else
  103.                     $v_Attributes = $CB_DDL_DIRECTORY
  104.                 EndIf
  105.             Case StringUpper($a_Attributes[$i]) = "H"
  106.                 If (StringLen($v_Attributes) > 0) Then
  107.                     $v_Attributes = $v_Attributes + $CB_DDL_HIDDEN
  108.                 Else
  109.                     $v_Attributes = $CB_DDL_HIDDEN
  110.                 EndIf
  111.             Case StringUpper($a_Attributes[$i]) = "RO"
  112.                 If (StringLen($v_Attributes) > 0) Then
  113.                     $v_Attributes = $v_Attributes + $CB_DDL_READONLY
  114.                 Else
  115.                     $v_Attributes = $CB_DDL_READONLY
  116.                 EndIf
  117.             Case StringUpper($a_Attributes[$i]) = "RW"
  118.                 If (StringLen($v_Attributes) > 0) Then
  119.                     $v_Attributes = $v_Attributes + $CB_DDL_READWRITE
  120.                 Else
  121.                     $v_Attributes = $CB_DDL_READWRITE
  122.                 EndIf
  123.             Case StringUpper($a_Attributes[$i]) = "S"
  124.                 If (StringLen($v_Attributes) > 0) Then
  125.                     $v_Attributes = $v_Attributes + $CB_DDL_SYSTEM
  126.                 Else
  127.                     $v_Attributes = $CB_DDL_SYSTEM
  128.                 EndIf
  129.             Case StringUpper($a_Attributes[$i]) = "DRIVES"
  130.                 $i_drives = 1
  131.                 $s_file = ""
  132.                 If (StringLen($v_Attributes) > 0) Then
  133.                     $v_Attributes = $v_Attributes + $CB_DDL_DRIVES
  134.                 Else
  135.                     $v_Attributes = $CB_DDL_DRIVES
  136.                 EndIf
  137.             Case StringUpper($a_Attributes[$i]) = "E"
  138.                 If (StringLen($v_Attributes) > 0) Then
  139.                     $v_Attributes = $v_Attributes + $CB_DDL_EXCLUSIVE
  140.                 Else
  141.                     $v_Attributes = $CB_DDL_EXCLUSIVE
  142.                 EndIf
  143.             Case StringUpper($a_Attributes[$i]) = "NB"
  144.                 If (StringLen($v_Attributes) > 0) And StringInStr($s_Attributes, "DRIVES") Then
  145.                     $no_brackets = 1
  146.                 Else
  147.                     $no_brackets = 0
  148.                 EndIf
  149.             Case Else
  150.                 ; invalid attribute
  151.                 Return $CB_ERRATTRIBUTE
  152.         EndSelect
  153.     Next
  154.     If (Not $i_drives And StringLen($s_file) == 0) Then Return $CB_ERRREQUIRED
  155.     If $i_drives And $no_brackets Then
  156.         Local $s_text
  157.         Local $gui_no_brackets = GUICreate("no brackets")
  158.         Local $combo_no_brackets = GUICtrlCreateCombo("", 70, 10, 270, 100, $CBS_SIMPLE)
  159.         $v_ret = GUICtrlSendMsg($combo_no_brackets, $CB_DIR, $v_Attributes, $s_file)
  160.         For $i = 0 To _GUICtrlComboGetCount($combo_no_brackets) - 1
  161.             _GUICtrlComboGetLBText($combo_no_brackets, $i, $s_text)
  162.             $s_text = StringReplace(StringReplace(StringReplace($s_text, "[", ""), "]", ":"), "-", "")
  163.             _GUICtrlComboInsertString($h_combobox, -1, $s_text)
  164.         Next
  165.         GUIDelete($gui_no_brackets)
  166.         Return $v_ret
  167.     Else
  168.         If IsHWnd($h_combobox) Then
  169.             $v_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_combobox, "int", $CB_DIR, "int", $v_Attributes, "str", $s_file)
  170.             Return $v_ret[0]
  171.         Else
  172.             Return GUICtrlSendMsg($h_combobox, $CB_DIR, $v_Attributes, $s_file)
  173.         EndIf
  174.     EndIf
  175. EndFunc   ;==>_GUICtrlComboAddDir
  176.  
  177. ;===============================================================================
  178. ;
  179. ; Description:            _GUICtrlComboAddString
  180. ; Parameter(s):        $h_combobox - controlID
  181. ;                            $s_text - String to add
  182. ; Requirement:            None
  183. ; Return Value(s):    The return value is the zero-based index to the string in the list box of the combo box.
  184. ;                            If an error occurs, the return value is $CB_ERR.
  185. ;                            If insufficient space is available to store the new string, it is $CB_ERRSPACE.
  186. ; User CallTip:        _GUICtrlComboAddString($h_combobox, $s_text) Add a string to the list box of a combo box (required: <GuiCombo.au3>)
  187. ; Author(s):            Gary Frost (custompcs at charter dot net)
  188. ; Note(s):                If the combo box does not have the CBS_SORT style,
  189. ;                            the string is added to the end of the list.
  190. ;                            Otherwise, the string is inserted into the list, and the list is sorted.
  191. ;
  192. ;===============================================================================
  193. Func _GUICtrlComboAddString($h_combobox, $s_text)
  194.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  195.     If IsHWnd($h_combobox) Then
  196.         Return _SendMessage($h_combobox, $CB_ADDSTRING, 0, $s_text, 0, "int", "str")
  197.     Else
  198.         Return GUICtrlSendMsg($h_combobox, $CB_ADDSTRING, 0, String($s_text))
  199.     EndIf
  200. EndFunc   ;==>_GUICtrlComboAddString
  201.  
  202. ;===============================================================================
  203. ;
  204. ; Description:            _GUICtrlComboAutoComplete
  205. ; Parameter(s):        $h_combobox - controlID
  206. ;                            $s_text - String for comparing against the combo's input box
  207. ; Requirement:            Misc
  208. ; Return Value(s):    None
  209. ; User CallTip:        _GUICtrlComboAutoComplete($h_combobox, ByRef $s_text) AutoComplete a combo box input(required: <GuiCombo.au3>)
  210. ; Author(s):            Gary Frost (custompcs at charter dot net)
  211. ; Note(s):
  212. ;
  213. ;===============================================================================
  214. Func _GUICtrlComboAutoComplete($h_combobox, ByRef $s_text, $s_WTitle = "", $s_WText = "")
  215.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, 0)
  216.     Local $ret, $s_inputtext, $s_data
  217.     If _IsPressed('08') Then ;backspace pressed
  218.         $s_text = GUICtrlRead($h_combobox)
  219.     Else
  220.         If IsHWnd($h_combobox) Then
  221.             If $s_text <> ControlGetText($s_WTitle, $s_WText, $h_combobox) Then
  222.                 $s_data = ControlGetText($s_WTitle, $s_WText, $h_combobox)
  223.                 $ret = _GUICtrlComboFindString($h_combobox, $s_data)
  224.                 If ($ret <> $CB_ERR) Then
  225.                     _GUICtrlComboGetLBText($h_combobox, $ret, $s_inputtext)
  226.                     ControlSetText($s_WTitle, $s_WText, $h_combobox, $s_inputtext)
  227.                     _GUICtrlComboSetEditSel($h_combobox, StringLen($s_data), StringLen(ControlGetText($s_WTitle, $s_WText, $h_combobox)))
  228.                 EndIf
  229.                 $s_text = ControlGetText(WinGetTitle(""), "", $h_combobox)
  230.             EndIf
  231.         Else
  232.             If $s_text <> GUICtrlRead($h_combobox) Then
  233.                 $s_data = GUICtrlRead($h_combobox)
  234.                 $ret = _GUICtrlComboFindString($h_combobox, $s_data)
  235.                 If ($ret <> $CB_ERR) Then
  236.                     _GUICtrlComboGetLBText($h_combobox, $ret, $s_inputtext)
  237.                     GUICtrlSetData($h_combobox, $s_inputtext)
  238.                     _GUICtrlComboSetEditSel($h_combobox, StringLen($s_data), StringLen(GUICtrlRead($h_combobox)))
  239.                 EndIf
  240.                 $s_text = GUICtrlRead($h_combobox)
  241.             EndIf
  242.         EndIf
  243.     EndIf
  244. EndFunc   ;==>_GUICtrlComboAutoComplete
  245.  
  246. ;===============================================================================
  247. ;
  248. ; Description:            _GUICtrlComboDeleteString
  249. ; Parameter(s):        $h_combobox - controlID
  250. ;                            $i_index - Specifies the zero-based index of the string
  251. ; Requirement:            None
  252. ; Return Value(s):    The return value is a count of the strings remaining in the list.
  253. ;                            If the $i_index parameter specifies an index greater than the number
  254. ;                            of items in the list, the return value is $CB_ERR.
  255. ; User CallTip:        _GUICtrlComboDeleteString($h_combobox, $i_index) Delete a string in the list box of a combo box (required: <GuiCombo.au3>)
  256. ; Author(s):            Gary Frost (custompcs at charter dot net)
  257. ; Note(s):                :
  258. ;
  259. ;===============================================================================
  260. Func _GUICtrlComboDeleteString($h_combobox, $i_index)
  261.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  262.     If IsHWnd($h_combobox) Then
  263.         Return _SendMessage($h_combobox, $CB_DELETESTRING, $i_index)
  264.     Else
  265.         Return GUICtrlSendMsg($h_combobox, $CB_DELETESTRING, $i_index, 0)
  266.     EndIf
  267. EndFunc   ;==>_GUICtrlComboDeleteString
  268.  
  269. ;===============================================================================
  270. ;
  271. ; Description:            _GUICtrlComboFindString
  272. ; Parameter(s):        $h_combobox - controlID
  273. ;                            $s_search - String to search for
  274. ;                            $i_exact - Optional: Exact match or not
  275. ; Requirement:            None
  276. ; Return Value(s):    The return value is the zero-based index of the matching item.
  277. ;                            If the search is unsuccessful, it is $CB_ERR.
  278. ; User CallTip:        _GUICtrlComboFindString($h_combobox, $s_search[, $i_exact=0]) Return the index of matching item (required: <GuiCombo.au3>)
  279. ; Author(s):            Gary Frost (custompcs at charter dot net)
  280. ; Note(s):                $i_exact = 0 Search the list box of a combo box for an item beginning with
  281. ;                                             the characters in a specified string
  282. ;                            $i_exact <> 0 Find the first list box string in a combo box that matches
  283. ;                                              the string specified in the $s_search parameter
  284. ;
  285. ;===============================================================================
  286. Func _GUICtrlComboFindString($h_combobox, $s_search, $i_exact = 0)
  287.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  288.     If IsHWnd($h_combobox) Then
  289.         If ($i_exact) Then
  290.             Return _SendMessage($h_combobox, $CB_FINDSTRINGEXACT, -1, $s_search, 0, "int", "str")
  291.         Else
  292.             Return _SendMessage($h_combobox, $CB_FINDSTRING, -1, $s_search, 0, "int", "str")
  293.         EndIf
  294.     Else
  295.         If ($i_exact) Then
  296.             Return GUICtrlSendMsg($h_combobox, $CB_FINDSTRINGEXACT, -1, String($s_search))
  297.         Else
  298.             Return GUICtrlSendMsg($h_combobox, $CB_FINDSTRING, -1, String($s_search))
  299.         EndIf
  300.     EndIf
  301. EndFunc   ;==>_GUICtrlComboFindString
  302.  
  303. ;===============================================================================
  304. ;
  305. ; Description:            _GUICtrlComboGetCount
  306. ; Parameter(s):        $h_combobox - controlID
  307. ; Requirement:            None
  308. ; Return Value(s):    The return value is the number of items in the list box.
  309. ;                            If an error occurs, it is $CB_ERR
  310. ; User CallTip:        _GUICtrlComboGetCount($h_combobox) Retrieve the number of items in the list box of a combo box (required: <GuiCombo.au3>)
  311. ; Author(s):            Gary Frost (custompcs at charter dot net)
  312. ; Note(s):                The index is zero-based, so the returned count is one greater
  313. ;                            than the index value of the last item.
  314. ;
  315. ;===============================================================================
  316. Func _GUICtrlComboGetCount($h_combobox)
  317.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  318.     If IsHWnd($h_combobox) Then
  319.         Return _SendMessage($h_combobox, $CB_GETCOUNT)
  320.     Else
  321.         Return GUICtrlSendMsg($h_combobox, $CB_GETCOUNT, 0, 0)
  322.     EndIf
  323. EndFunc   ;==>_GUICtrlComboGetCount
  324.  
  325. ;===============================================================================
  326. ;
  327. ; Description:            _GUICtrlComboGetCurSel
  328. ; Parameter(s):        $h_combobox - controlID
  329. ; Requirement:            None
  330. ; Return Value(s):    The return value is the zero-based index of the currently selected item.
  331. ;                            If no item is selected, it is $CB_ERR
  332. ; User CallTip:        _GUICtrlComboGetCurSel($h_combobox) Retrieve the index of the currently selected item, if any, in the list box of a combo box (required: <GuiCombo.au3>)
  333. ; Author(s):            Gary Frost (custompcs at charter dot net)
  334. ; Note(s):                :
  335. ;
  336. ;===============================================================================
  337. Func _GUICtrlComboGetCurSel($h_combobox)
  338.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  339.     If IsHWnd($h_combobox) Then
  340.         Return _SendMessage($h_combobox, $CB_GETCURSEL)
  341.     Else
  342.         Return GUICtrlSendMsg($h_combobox, $CB_GETCURSEL, 0, 0)
  343.     EndIf
  344. EndFunc   ;==>_GUICtrlComboGetCurSel
  345.  
  346. ;===============================================================================
  347. ;
  348. ; Description:            _GUICtrlComboGetDroppedControlRect
  349. ; Parameter(s):        $h_combobox - controlID
  350. ; Requirement:            None
  351. ; Return Value(s):    Array containing the RECT, first element ($array[0]) contains the number of elements
  352. ;                            If an error occurs, the return value is $CB_ERR.
  353. ; User CallTip:        _GUICtrlComboGetDroppedControlRect($h_combobox) Retrieve the screen coordinates of a combo box in its dropped-down state. (required: <GuiCombo.au3>)
  354. ; Author(s):            Gary Frost (custompcs at charter dot net)
  355. ; Note(s):                $array[1] - left
  356. ;                            $array[2] - top
  357. ;                            $array[3] - right
  358. ;                            $array[4] - bottom
  359. ;
  360. ;===============================================================================
  361. Func _GUICtrlComboGetDroppedControlRect($h_combobox)
  362.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  363. ;~     typedef struct _RECT {
  364. ;~       LONG left;
  365. ;~       LONG top;
  366. ;~       LONG right;
  367. ;~       LONG bottom;
  368. ;~     } RECT, *PRECT;
  369.     Local $RECT = "int;int;int;int"
  370.     Local $left = 1
  371.     Local $top = 2
  372.     Local $right = 3
  373.     Local $bottom = 4
  374.     Local $struct_RECT
  375.     $struct_RECT = DllStructCreate($RECT)
  376.     If @error Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  377.     If IsHWnd($h_combobox) Then
  378.         _SendMessage($h_combobox, $CB_GETDROPPEDCONTROLRECT, 0, DllStructGetPtr($struct_RECT), 0, "int", "ptr")
  379.     Else
  380.         GUICtrlSendMsg($h_combobox, $CB_GETDROPPEDCONTROLRECT, 0, DllStructGetPtr($struct_RECT))
  381.     EndIf
  382.     If @error Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  383.     Local $array = StringSplit(DllStructGetData($struct_RECT, $left) & "," & DllStructGetData($struct_RECT, $top) & "," & DllStructGetData($struct_RECT, $right) & "," & DllStructGetData($struct_RECT, $bottom), ",")
  384.     ;   DllStructDelete($p)
  385.     Return $array
  386. EndFunc   ;==>_GUICtrlComboGetDroppedControlRect
  387.  
  388. ;===============================================================================
  389. ;
  390. ; Description:            _GUICtrlComboGetDroppedState
  391. ; Parameter(s):        $h_combobox - controlID
  392. ; Requirement:            None
  393. ; Return Value(s):    If the list box is visible, the return value is TRUE
  394. ;                             otherwise, it is FALSE
  395. ; User CallTip:        _GUICtrlComboGetDroppedState($h_combobox) Determine whether the list box of a combo box is dropped down (required: <GuiCombo.au3>)
  396. ; Author(s):            Gary Frost (custompcs at charter dot net)
  397. ; Note(s):                :
  398. ;
  399. ;===============================================================================
  400. Func _GUICtrlComboGetDroppedState($h_combobox)
  401.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, False)
  402.     If IsHWnd($h_combobox) Then
  403.         Return _SendMessage($h_combobox, $CB_GETDROPPEDSTATE)
  404.     Else
  405.         Return GUICtrlSendMsg($h_combobox, $CB_GETDROPPEDSTATE, 0, 0)
  406.     EndIf
  407. EndFunc   ;==>_GUICtrlComboGetDroppedState
  408.  
  409. ;===============================================================================
  410. ;
  411. ; Description:            _GUICtrlComboGetDroppedWidth
  412. ; Parameter(s):        $h_combobox - controlID
  413. ; Requirement:            CBS_DROPDOWN or CBS_DROPDOWNLIST style
  414. ; Return Value(s):    If the message succeeds, the return value is the width, in pixels.
  415. ;                            If the message fails, the return value is $CB_ERR
  416. ; User CallTip:        _GUICtrlComboGetDroppedWidth($h_combobox) Retrieve the minimum allowable width, of the list box of a combo box (required: <GuiCombo.au3>)
  417. ; Author(s):            Gary Frost (custompcs at charter dot net)
  418. ; Note(s):                :
  419. ;
  420. ;===============================================================================
  421. Func _GUICtrlComboGetDroppedWidth($h_combobox)
  422.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  423.     If IsHWnd($h_combobox) Then
  424.         Return _SendMessage($h_combobox, $CB_GETDROPPEDWIDTH)
  425.     Else
  426.         Return GUICtrlSendMsg($h_combobox, $CB_GETDROPPEDWIDTH, 0, 0)
  427.     EndIf
  428. EndFunc   ;==>_GUICtrlComboGetDroppedWidth
  429.  
  430. ;===============================================================================
  431. ;
  432. ; Description:            _GUICtrlComboGetEditSel
  433. ; Parameter(s):        $h_combobox - controlID
  434. ; Requirement:            None
  435. ; Return Value(s):    Array containing the starting and ending selected positions, first element ($array[0]) contains the number of elements
  436. ;                            If an error occurs, the return value is $CB_ERR.
  437. ; User CallTip:        _GUICtrlComboGetEditSel($h_combobox) Get the starting and ending character positions of the current selection in the edit control of a combo box. (required: <GuiCombo.au3>)
  438. ; Author(s):            Gary Frost (custompcs at charter dot net)
  439. ; Note(s):                $array[1] - starting position
  440. ;                            $array[2] - ending position
  441. ;
  442. ;===============================================================================
  443. Func _GUICtrlComboGetEditSel($h_combobox)
  444.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  445.     Local $struct_start = "dword"
  446.     Local $struct_end = "dword"
  447.     Local $ret
  448.     Local $ss = DllStructCreate($struct_start)
  449.     If @error Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  450.     Local $se = DllStructCreate($struct_end)
  451.     If @error Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  452.     If IsHWnd($h_combobox) Then
  453.         $ret = _SendMessage($h_combobox, $CB_GETEDITSEL, DllStructGetPtr($ss), DllStructGetPtr($se), "int", "ptr", "ptr")
  454.     Else
  455.         $ret = GUICtrlSendMsg($h_combobox, $CB_GETEDITSEL, DllStructGetPtr($ss), DllStructGetPtr($se))
  456.     EndIf
  457.     If (Not $ret) Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  458.     Local $s_start_end = DllStructGetData($ss, 1) & "," & DllStructGetData($se, 1)
  459.     Return StringSplit($s_start_end, ",")
  460. EndFunc   ;==>_GUICtrlComboGetEditSel
  461.  
  462. ;===============================================================================
  463. ;
  464. ; Description:            _GUICtrlComboGetExtendedUI
  465. ; Parameter(s):        $h_combobox - controlID
  466. ; Requirement:            None
  467. ; Return Value(s):    If the combo box has the extended user interface,
  468. ;                            the return value is TRUE; otherwise, it is FALSE
  469. ; User CallTip:        _GUICtrlComboGetExtendedUI($h_combobox) Determine whether a combo box has the default user interface or the extended user interface (required: <GuiCombo.au3>)
  470. ; Author(s):            Gary Frost (custompcs at charter dot net)
  471. ; Note(s):                By default, the F4 key opens or closes the list and the
  472. ;                            DOWN ARROW changes the current selection.
  473. ;                            In a combo box with the extended user interface, the F4
  474. ;                            key is disabled and pressing the DOWN ARROW key opens the
  475. ;                            drop-down list.
  476. ;
  477. ;===============================================================================
  478. Func _GUICtrlComboGetExtendedUI($h_combobox)
  479.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, False)
  480.     If IsHWnd($h_combobox) Then
  481.         Return _SendMessage($h_combobox, $CB_GETEXTENDEDUI)
  482.     Else
  483.         Return GUICtrlSendMsg($h_combobox, $CB_GETEXTENDEDUI, 0, 0)
  484.     EndIf
  485. EndFunc   ;==>_GUICtrlComboGetExtendedUI
  486.  
  487. ;===============================================================================
  488. ;
  489. ; Description:            _GUICtrlComboGetHorizontalExtent
  490. ; Parameter(s):        $h_combobox - controlID
  491. ; Requirement:            None
  492. ; Return Value(s):    The return value is the scrollable width, in pixels.
  493. ; User CallTip:        _GUICtrlComboGetHorizontalExtent($h_combobox) Retrieve from a combo box the width, in pixels (required: <GuiCombo.au3>)
  494. ; Author(s):            Gary Frost (custompcs at charter dot net)
  495. ; Note(s):                Retrieve from a combo box the width, in pixels, by which the
  496. ;                            list box can be scrolled horizontally (the scrollable width).
  497. ;                            This is applicable only if the list box has a horizontal scroll bar.
  498. ;
  499. ;===============================================================================
  500. Func _GUICtrlComboGetHorizontalExtent($h_combobox)
  501.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  502.     If IsHWnd($h_combobox) Then
  503.         Return _SendMessage($h_combobox, $CB_GETHORIZONTALEXTENT)
  504.     Else
  505.         Return GUICtrlSendMsg($h_combobox, $CB_GETHORIZONTALEXTENT, 0, 0)
  506.     EndIf
  507. EndFunc   ;==>_GUICtrlComboGetHorizontalExtent
  508.  
  509. ;===============================================================================
  510. ;
  511. ; Description:            _GUICtrlComboGetItemHeight
  512. ; Parameter(s):        $h_combobox - controlID
  513. ;                            $i_index - Specifies the zero-based index of the string
  514. ; Requirement:            None
  515. ; Return Value(s):    The return value is the height, in pixels, of the list items in a combo box.
  516. ;                            If the combo box has the CBS_OWNERDRAWVARIABLE style, it is the height of the
  517. ;                            item specified by the $i_index parameter. If $i_index is û1, the return value
  518. ;                            is the height of the edit control (or static-text) portion of the combo box.
  519. ;                            If an error occurs, the return value is $CB_ERR
  520. ; User CallTip:        _GUICtrlComboGetItemHeight($h_combobox[, $i_index=-1]) Determine the height of list items or the selection field in a combo box (required: <GuiCombo.au3>)
  521. ; Author(s):            Gary Frost (custompcs at charter dot net)
  522. ; Note(s):                :
  523. ;
  524. ;===============================================================================
  525. Func _GUICtrlComboGetItemHeight($h_combobox, $i_index = -1)
  526.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  527.     If IsHWnd($h_combobox) Then
  528.         Return _SendMessage($h_combobox, $CB_GETITEMHEIGHT, $i_index)
  529.     Else
  530.         Return GUICtrlSendMsg($h_combobox, $CB_GETITEMHEIGHT, $i_index, 0)
  531.     EndIf
  532. EndFunc   ;==>_GUICtrlComboGetItemHeight
  533.  
  534. ;===============================================================================
  535. ;
  536. ; Description:            _GUICtrlComboGetLBText
  537. ; Parameter(s):        $h_combobox - controlID
  538. ;                            $i_index - Specifies the zero-based index of the string to retrieve.
  539. ;                            $s_text - Buffer that receives the string
  540. ; Requirement:            None
  541. ; Return Value(s):    The return value is the length of the string, in TCHARs,
  542. ;                            excluding the terminating null character.
  543. ;                            If $i_index does not specify a valid index, the return value is $CB_ERR.
  544. ; User CallTip:        _GUICtrlComboGetLBText($h_combobox, $i_index, ByRef $s_text) Retrieve a string from the list of a combo box. (required: <GuiCombo.au3>)
  545. ; Author(s):            Gary Frost (custompcs at charter dot net)
  546. ; Note(s):                Must call _GUICtrlComboGetLBTextLen 1st and get the length
  547. ;
  548. ;===============================================================================
  549. Func _GUICtrlComboGetLBText($h_combobox, $i_index, ByRef $s_text)
  550.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  551.     Local $len = _GUICtrlComboGetLBTextLen($h_combobox, $i_index)
  552.     
  553.     $s_text = ""
  554.     Local $ret, $struct = DllStructCreate("char[" & $len + 1 & "]")
  555.     If Not IsHWnd($h_combobox) Then $h_combobox = GUICtrlGetHandle($h_combobox)
  556.     $ret = DllCall("user32.dll", "int", "SendMessageA", "hwnd", $h_combobox, "int", $CB_GETLBTEXT, "int", $i_index, "ptr", DllStructGetPtr($struct))
  557.     If ($ret[0] == $CB_ERR) Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  558.     $s_text = DllStructGetData($struct, 1)
  559.     Return $ret
  560. EndFunc   ;==>_GUICtrlComboGetLBText
  561.  
  562. ;===============================================================================
  563. ;
  564. ; Description:            _GUICtrlComboGetLBTextLen
  565. ; Parameter(s):        $h_combobox - controlID
  566. ;                            $i_index - Specifies the zero-based index of the string
  567. ; Requirement:            None
  568. ; Return Value(s):    The return value is the length of the string, in TCHARs,
  569. ;                            excluding the terminating null character.
  570. ;                            If an ANSI string this is the number of bytes, and if it
  571. ;                            is a Unicode string this is the number of characters.
  572. ;                            If the $i_index parameter does not specify a valid index,
  573. ;                            the return value is $CB_ERR
  574. ; User CallTip:        _GUICtrlComboGetLBTextLen($h_combobox, $i_index) Retrieve the length, in characters, of a string in the list of a combo box (required: <GuiCombo.au3>)
  575. ; Author(s):            Gary Frost (custompcs at charter dot net)
  576. ; Note(s):                Under certain conditions, the return value is larger than the
  577. ;                            actual length of the text. This occurs with certain mixtures of
  578. ;                            ANSI and Unicode, and is due to the operating system allowing for
  579. ;                            the possible existence of double-byte character set (DBCS) characters
  580. ;                            within the text. The return value, however, will always be at least
  581. ;                            as large as the actual length of the text; so you can always use it
  582. ;                            to guide buffer allocation.
  583. ;                            This behavior can occur when an application uses both ANSI functions
  584. ;                            and common dialogs, which use Unicode.
  585. ;                            To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT,
  586. ;                            or CB_GETLBTEXT messages, or the GetWindowText function
  587. ;
  588. ;===============================================================================
  589. Func _GUICtrlComboGetLBTextLen($h_combobox, $i_index)
  590.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  591.     If IsHWnd($h_combobox) Then
  592.         Return _SendMessage($h_combobox, $CB_GETLBTEXTLEN, $i_index)
  593.     Else
  594.         Return GUICtrlSendMsg($h_combobox, $CB_GETLBTEXTLEN, $i_index, 0)
  595.     EndIf
  596. EndFunc   ;==>_GUICtrlComboGetLBTextLen
  597.  
  598. ;===============================================================================
  599. ;
  600. ; Function Name:    _GUICtrlComboGetList()
  601. ; Description:      Retrieves all items from the list portion of a ComboBox control.
  602. ; Parameter(s):     $a_Array      - Array
  603. ;                   $idCombo - Control ID of the combo.
  604. ;                   $sDelimiter - Delimeter used to seperate each item (Defaults to |).
  605. ; Requirement(s):   _GUICtrlComboGetCount(), _GUICtrlComboGetLBText()
  606. ; Return Value(s):  Delimited string of all ComboBox items.
  607. ; Author(s):        Jason Boggs
  608. ;
  609. ;===============================================================================
  610. Func _GUICtrlComboGetList($h_combobox, $sDelimiter = "|")
  611.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, "")
  612.     Local $sResult, $sItem
  613.     For $i = 0 To _GUICtrlComboGetCount($h_combobox) - 1
  614.         _GUICtrlComboGetLBText($h_combobox, $i, $sItem)
  615.         $sResult &= $sItem & $sDelimiter
  616.     Next
  617.     $sResult = StringTrimRight($sResult, StringLen($sDelimiter))
  618.     Return $sResult
  619. EndFunc   ;==>_GUICtrlComboGetList
  620.  
  621. ;===============================================================================
  622. ;
  623. ; Description:            _GUICtrlComboGetLocale
  624. ; Parameter(s):        $h_combobox - controlID
  625. ; Requirement:            None
  626. ; Return Value(s):    Returns the current Local of the combobox
  627. ;                             same as @OSLang unless changed
  628. ; User CallTip:        _GUICtrlComboGetLocale($h_combobox) Retrieve the current locale of the combo box (required: <GuiCombo.au3>)
  629. ; Author(s):            Gary Frost (custompcs at charter dot net)
  630. ; Note(s):                "0409" for U.S. English
  631. ;                            see @OSLang for string values
  632. ;
  633. ;===============================================================================
  634. Func _GUICtrlComboGetLocale($h_combobox)
  635.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  636.     If IsHWnd($h_combobox) Then
  637.         Return Hex(_SendMessage($h_combobox, $CB_GETLOCALE), 4)
  638.     Else
  639.         Return Hex(GUICtrlSendMsg($h_combobox, $CB_GETLOCALE, 0, 0), 4)
  640.     EndIf
  641. EndFunc   ;==>_GUICtrlComboGetLocale
  642.  
  643. ;===============================================================================
  644. ;
  645. ; Description:            _GUICtrlComboGetMinVisible
  646. ; Parameter(s):        $h_combobox - controlID
  647. ; Requirement:            None
  648. ; Return Value(s):    The return value is the minimum number of visible items
  649. ; User CallTip:        _GUICtrlComboGetMinVisible($h_combobox) Get the minimum number of visible items in the drop-down list of a combo box (required: <GuiCombo.au3>)
  650. ; Author(s):            Gary Frost (custompcs at charter dot net)
  651. ; Note(s):                When the number of items in the drop-down list is greater
  652. ;                            than the minimum, the combo box uses a scrollbar.
  653. ;                            This message is ignored if the combo box control has style
  654. ;                            CBS_NOINTEGRALHEIGHT.
  655. ;                            To use CB_GETMINVISIBLE, the application must specify comctl32.dll
  656. ;                            version 6 in the manifest. For more information, see
  657. ;                            Using Windows XP Visual Styles
  658. ;
  659. ;===============================================================================
  660. Func _GUICtrlComboGetMinVisible($h_combobox)
  661.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  662.     If IsHWnd($h_combobox) Then
  663.         Return _SendMessage($h_combobox, $CB_GETMINVISIBLE)
  664.     Else
  665.         Return GUICtrlSendMsg($h_combobox, $CB_GETMINVISIBLE, 0, 0)
  666.     EndIf
  667. EndFunc   ;==>_GUICtrlComboGetMinVisible
  668.  
  669. ;===============================================================================
  670. ;
  671. ; Description:            _GUICtrlComboGetTopIndex
  672. ; Parameter(s):        $h_combobox - controlID
  673. ; Requirement:            None
  674. ; Return Value(s):    If the message is successful, the return value is the index of the first
  675. ;                            visible item in the list box of the combo box.
  676. ;                            If the message fails, the return value is $CB_ERR
  677. ; User CallTip:        _GUICtrlComboGetTopIndex($h_combobox) Retrieve the zero-based index of the first visible item in the list box portion of a combo box (required: <GuiCombo.au3>)
  678. ; Author(s):            Gary Frost (custompcs at charter dot net)
  679. ; Note(s):                Initially, the item with index 0 is at the top of the list box,
  680. ;                            but if the list box contents have been scrolled, another item may be at the top
  681. ;
  682. ;===============================================================================
  683. Func _GUICtrlComboGetTopIndex($h_combobox)
  684.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  685.     If IsHWnd($h_combobox) Then
  686.         Return _SendMessage($h_combobox, $CB_GETTOPINDEX)
  687.     Else
  688.         Return GUICtrlSendMsg($h_combobox, $CB_GETTOPINDEX, 0, 0)
  689.     EndIf
  690. EndFunc   ;==>_GUICtrlComboGetTopIndex
  691.  
  692. ;===============================================================================
  693. ;
  694. ; Description:            _GUICtrlComboInitStorage
  695. ; Parameter(s):        $h_combobox - controlID
  696. ;                            $i_num - Specifies the number of items to add
  697. ;                            $i_bytes - Specifies the amount of memory to allocate for item strings, in bytes
  698. ; Requirement:            None
  699. ; Return Value(s):    If the message is successful, the return value is the total number
  700. ;                            of items for which memory has been pre-allocated, that is, the total
  701. ;                            number of items added by all successful CB_INITSTORAGE messages.
  702. ;                            If the message fails, the return value is $CB_ERRSPACE
  703. ; User CallTip:        _GUICtrlComboInitStorage($h_combobox, $i_num, $i_bytes) Allocates memory for storing list box items (required: <GuiCombo.au3>)
  704. ; Author(s):            Gary Frost (custompcs at charter dot net)
  705. ; Note(s):                Windows NT 4.0: This message does not allocate the specified amount of memory
  706. ;                             however, it always returns the value specified in the $i_num parameter.
  707. ;                            Windows 2000/XP: The message allocates memory and returns the success and error values described above
  708. ;
  709. ;                            The CB_INITSTORAGE message helps speed up the initialization of combo boxes
  710. ;                            that have a large number of items (over 100).
  711. ;                            It reserves the specified amount of memory so that subsequent CB_ADDSTRING,
  712. ;                            CB_INSERTSTRING, and CB_DIR messages take the shortest possible time.
  713. ;                            You can use estimates for the $i_num and $i_bytes parameters.
  714. ;                            If you overestimate, the extra memory is allocated,
  715. ;                            if you underestimate, the normal allocation is used for items that exceed the requested amount
  716. ;
  717. ;===============================================================================
  718. Func _GUICtrlComboInitStorage($h_combobox, $i_num, $i_bytes)
  719.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  720.     If IsHWnd($h_combobox) Then
  721.         Return _SendMessage($h_combobox, $CB_INITSTORAGE, $i_num, $i_bytes)
  722.     Else
  723.         Return GUICtrlSendMsg($h_combobox, $CB_INITSTORAGE, $i_num, $i_bytes)
  724.     EndIf
  725. EndFunc   ;==>_GUICtrlComboInitStorage
  726.  
  727. ;===============================================================================
  728. ;
  729. ; Description:            _GUICtrlComboInsertString
  730. ; Parameter(s):        $h_combobox - controlID
  731. ;                            $i_index - Specifies the zero-based index of the position at which to insert the string
  732. ;                            $s_text - String to insert
  733. ; Requirement:            None
  734. ; Return Value(s):    The return value is the index of the position at which the string was inserted.
  735. ;                            If an error occurs, the return value is $CB_ERR.
  736. ;                            If there is insufficient space available to store the new string, it is $CB_ERRSPACE
  737. ; User CallTip:        _GUICtrlComboInsertString($h_combobox, $i_index , $s_text) Insert a string into the list box of a combo box (required: <GuiCombo.au3>)
  738. ; Author(s):            Gary Frost (custompcs at charter dot net)
  739. ; Note(s):                If the $i_index parameter is û1, the string is added to the end of the list
  740. ;                            If the combo box has WS_HSCROLL style and you insert a string wider than the
  741. ;                            combo box, you should send a LB_SETHORIZONTALEXTENT message to ensure the
  742. ;                            horizontal scrollbar appears
  743. ;
  744. ;===============================================================================
  745. Func _GUICtrlComboInsertString($h_combobox, $i_index, $s_text)
  746.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  747.     If IsHWnd($h_combobox) Then
  748.         Return _SendMessage($h_combobox, $CB_INSERTSTRING, $i_index, $s_text, 0, "int", "str")
  749.     Else
  750.         Return GUICtrlSendMsg($h_combobox, $CB_INSERTSTRING, $i_index, String($s_text))
  751.     EndIf
  752. EndFunc   ;==>_GUICtrlComboInsertString
  753.  
  754. ;===============================================================================
  755. ;
  756. ; Description:            _GUICtrlComboLimitText
  757. ; Parameter(s):        $h_combobox - controlID
  758. ;                            $i_limit - Optional: Specifies the maximum number of characters the user can enter
  759. ; Requirement:            None
  760. ; Return Value(s):    None
  761. ; User CallTip:        _GUICtrlComboLimitText($h_combobox[, $i_limit=0]) Limit the length of the text the user may type into the edit control of a combo box (required: <GuiCombo.au3>)
  762. ; Author(s):            Gary Frost (custompcs at charter dot net)
  763. ; Note(s):                If the $i_limit parameter is zero, the text length is limited to 0x7FFFFFFE characters
  764. ;                            If the combo box does not have the CBS_AUTOHSCROLL style, setting the text limit to
  765. ;                            be larger than the size of the edit control has no effect.
  766. ;                            The CB_LIMITTEXT message limits only the text the user can enter.
  767. ;                            It has no effect on any text already in the edit control when the message is sent,
  768. ;                            nor does it affect the length of the text copied to the edit control when a string
  769. ;                            in the list box is selected.
  770. ;                            The default limit to the text a user can enter in the edit control is 30,000 characters
  771. ;
  772. ;===============================================================================
  773. Func _GUICtrlComboLimitText($h_combobox, $i_limit = 0)
  774.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, 0)
  775.     If IsHWnd($h_combobox) Then
  776.         _SendMessage($h_combobox, $CB_LIMITTEXT, $i_limit)
  777.     Else
  778.         GUICtrlSendMsg($h_combobox, $CB_LIMITTEXT, $i_limit, 0)
  779.     EndIf
  780. EndFunc   ;==>_GUICtrlComboLimitText
  781.  
  782. ;===============================================================================
  783. ;
  784. ; Description:            _GUICtrlComboResetContent
  785. ; Parameter(s):        $h_combobox - controlID
  786. ; Requirement:            None
  787. ; Return Value(s):    None
  788. ; User CallTip:        _GUICtrlComboResetContent($h_combobox) Remove all items from the list box and edit control of a combo box (required: <GuiCombo.au3>)
  789. ; Author(s):            Gary Frost (custompcs at charter dot net)
  790. ; Note(s):                :
  791. ;
  792. ;===============================================================================
  793. Func _GUICtrlComboResetContent($h_combobox)
  794.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, 0)
  795.     If IsHWnd($h_combobox) Then
  796.         _SendMessage($h_combobox, $CB_RESETCONTENT)
  797.     Else
  798.         GUICtrlSendMsg($h_combobox, $CB_RESETCONTENT, 0, 0)
  799.     EndIf
  800. EndFunc   ;==>_GUICtrlComboResetContent
  801.  
  802. ;===============================================================================
  803. ;
  804. ; Description:            _GUICtrlComboSelectString
  805. ; Parameter(s):        $h_combobox - controlID
  806. ;                            $i_index - Specifies the zero-based index of the item preceding the first item to be searched
  807. ;                            $s_search - String that contains the characters for which to search
  808. ; Requirement:            None
  809. ; Return Value(s):    If the string is found, the return value is the index of the selected item.
  810. ;                            If the search is unsuccessful, the return value is $CB_ERR and the current selection is not changed
  811. ; User CallTip:        _GUICtrlComboSelectString($h_combobox, $i_index, $s_search) Search the list of a combo box for an item that begins with the characters in a specified string (required: <GuiCombo.au3>)
  812. ; Author(s):            Gary Frost (custompcs at charter dot net)
  813. ; Note(s):                When the search reaches the bottom of the list, it continues from the top
  814. ;                            of the list back to the item specified by the wParam parameter.
  815. ;                            If $i_index is û1, the entire list is searched from the beginning
  816. ;                            A string is selected only if the characters from the starting point
  817. ;                            match the characters in the prefix string
  818. ;
  819. ;===============================================================================
  820. Func _GUICtrlComboSelectString($h_combobox, $i_index, $s_search)
  821.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  822.     If IsHWnd($h_combobox) Then
  823.         Return _SendMessage($h_combobox, $CB_SELECTSTRING, $i_index, $s_search, 0, "int", "str")
  824.     Else
  825.         Return GUICtrlSendMsg($h_combobox, $CB_SELECTSTRING, $i_index, String($s_search))
  826.     EndIf
  827. EndFunc   ;==>_GUICtrlComboSelectString
  828.  
  829. ;===============================================================================
  830. ;
  831. ; Description:            _GUICtrlComboSetCurSel
  832. ; Parameter(s):        $h_combobox - controlID
  833. ;                            $i_index - Specifies the zero-based index of the string to select
  834. ; Requirement:            None
  835. ; Return Value(s):    If the message is successful, the return value is the index of the item selected.
  836. ;                            If $i_index is greater than the number of items in the list or if $i_index is û1,
  837. ;                            the return value is $CB_ERR and the selection is cleared
  838. ; User CallTip:        _GUICtrlComboSetCurSel($h_combobox, $i_index) Select a string in the list of a combo box (required: <GuiCombo.au3>)
  839. ; Author(s):            Gary Frost (custompcs at charter dot net)
  840. ; Note(s):                If this $i_index is û1, any current selection in the list is removed and the edit control is cleared
  841. ;
  842. ;===============================================================================
  843. Func _GUICtrlComboSetCurSel($h_combobox, $i_index)
  844.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  845.     If IsHWnd($h_combobox) Then
  846.         Return _SendMessage($h_combobox, $CB_SETCURSEL, $i_index)
  847.     Else
  848.         Return GUICtrlSendMsg($h_combobox, $CB_SETCURSEL, $i_index, 0)
  849.     EndIf
  850. EndFunc   ;==>_GUICtrlComboSetCurSel
  851.  
  852. ;===============================================================================
  853. ;
  854. ; Description:            _GUICtrlComboSetDroppedWidth
  855. ; Parameter(s):        $h_combobox - controlID
  856. ;                            $i_width - Specifies the width of the list box, in pixels
  857. ; Requirement:            CBS_DROPDOWN or CBS_DROPDOWNLIST style
  858. ; Return Value(s):    If the message is successful, The return value is the new width of the list box.
  859. ;                            If the message fails, the return value is $CB_ERR
  860. ; User CallTip:        _GUICtrlComboSetDroppedWidth($h_combobox, $i_width) Set the maximum allowable width (required: <GuiCombo.au3>)
  861. ; Author(s):            Gary Frost (custompcs at charter dot net)
  862. ; Note(s):                By default, the minimum allowable width of the drop-down list box is zero.
  863. ;                            The width of the list box is either the minimum allowable width or the
  864. ;                            combo box width, whichever is larger
  865. ;
  866. ;===============================================================================
  867. Func _GUICtrlComboSetDroppedWidth($h_combobox, $i_width)
  868.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  869.     If IsHWnd($h_combobox) Then
  870.         Return _SendMessage($h_combobox, $CB_SETDROPPEDWIDTH, $i_width)
  871.     Else
  872.         Return GUICtrlSendMsg($h_combobox, $CB_SETDROPPEDWIDTH, $i_width, 0)
  873.     EndIf
  874. EndFunc   ;==>_GUICtrlComboSetDroppedWidth
  875.  
  876. ;===============================================================================
  877. ;
  878. ; Description:            _GUICtrlComboSetEditSel
  879. ; Parameter(s):        $h_combobox - controlID
  880. ;                            $i_start - Starting position
  881. ;                            $i_stop - Ending position
  882. ; Requirement:            None
  883. ; Return Value(s):    If the message succeeds, the return value is TRUE.
  884. ;                            If the message is sent to a combo box with the CBS_DROPDOWNLIST style, it is $CB_ERR
  885. ; User CallTip:        _GUICtrlComboSetEditSel($h_combobox, $i_start, $i_stop) Select characters in the edit control of a combo box (required: <GuiCombo.au3>)
  886. ; Author(s):            Gary Frost (custompcs at charter dot net)
  887. ; Note(s):                The positions are zero-based.
  888. ;                            The first character of the edit control is in the zero position.
  889. ;                            The first character after the last selected character is in the ending position.
  890. ;                            For example, to select the first four characters of the edit control,
  891. ;                            use a starting position of 0 and an ending position of 4
  892. ;
  893. ;===============================================================================
  894. Func _GUICtrlComboSetEditSel($h_combobox, $i_start, $i_stop)
  895.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  896.     If IsHWnd($h_combobox) Then
  897.         Return _SendMessage($h_combobox, $CB_SETEDITSEL, 0, $i_stop * 65536 + $i_start)
  898.     Else
  899.         Return GUICtrlSendMsg($h_combobox, $CB_SETEDITSEL, 0, $i_stop * 65536 + $i_start)
  900.     EndIf
  901. EndFunc   ;==>_GUICtrlComboSetEditSel
  902.  
  903. ;===============================================================================
  904. ;
  905. ; Description:            _GUICtrlComboSetExtendedUI
  906. ; Parameter(s):        $h_combobox - controlID
  907. ;                            $i_bool - Specifies whether the combo box uses the extended user interface or the default user interface
  908. ; Requirement:            None
  909. ; Return Value(s):    If the operation succeeds, the return value is CB_OKAY.
  910. ;                            If an error occurs, it is $CB_ERR
  911. ; User CallTip:        _GUICtrlComboSetExtendedUI($h_combobox, $i_bool) Select either the default user interface or the extended user interface (required: <GuiCombo.au3>)
  912. ; Author(s):            Gary Frost (custompcs at charter dot net)
  913. ; Note(s):                By default, the F4 key opens or closes the list and the
  914. ;                            DOWN ARROW changes the current selection. In the extended
  915. ;                            user interface, the F4 key is disabled and the DOWN ARROW
  916. ;                            key opens the drop-down list
  917. ;                            $i_bool specifies whether the combo box uses the extended
  918. ;                            user interface or the default user interface.
  919. ;                            A value of TRUE selects the extended user interface
  920. ;                             A value of FALSE selects the standard user interface
  921. ;
  922. ;===============================================================================
  923. Func _GUICtrlComboSetExtendedUI($h_combobox, $i_bool)
  924.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  925.     If IsHWnd($h_combobox) Then
  926.         Return _SendMessage($h_combobox, $CB_SETEXTENDEDUI, $i_bool)
  927.     Else
  928.         Return GUICtrlSendMsg($h_combobox, $CB_SETEXTENDEDUI, $i_bool, 0)
  929.     EndIf
  930. EndFunc   ;==>_GUICtrlComboSetExtendedUI
  931.  
  932. ;===============================================================================
  933. ;
  934. ; Description:            _GUICtrlComboSetHorizontalExtent
  935. ; Parameter(s):        $h_combobox - controlID
  936. ;                            $i_width - Specifies the scrollable width of the list box, in pixels
  937. ; Requirement:            None
  938. ; Return Value(s):    None
  939. ; User CallTip:        _GUICtrlComboSetHorizontalExtent($h_combobox, $i_width) Set the width, in pixels (required: <GuiCombo.au3>)
  940. ; Author(s):            Gary Frost (custompcs at charter dot net)
  941. ; Note(s):                An application sends the CB_SETHORIZONTALEXTENT message to set the width,
  942. ;                            in pixels, by which a list box can be scrolled horizontally (the scrollable width).
  943. ;                            If the width of the list box is smaller than this value, the horizontal scroll bar
  944. ;                            horizontally scrolls items in the list box.
  945. ;                            If the width of the list box is equal to or greater than this value, the horizontal
  946. ;                            scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled
  947. ;
  948. ;===============================================================================
  949. Func _GUICtrlComboSetHorizontalExtent($h_combobox, $i_width)
  950.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  951.     If IsHWnd($h_combobox) Then
  952.         _SendMessage($h_combobox, $CB_SETHORIZONTALEXTENT, $i_width)
  953.     Else
  954.         GUICtrlSendMsg($h_combobox, $CB_SETHORIZONTALEXTENT, $i_width, 0)
  955.     EndIf
  956. EndFunc   ;==>_GUICtrlComboSetHorizontalExtent
  957.  
  958. ;===============================================================================
  959. ;
  960. ; Description:            _GUICtrlComboSetItemHeight
  961. ; Parameter(s):        $h_combobox - controlID
  962. ;                            $i_component - Specifies the component of the combo box for which to set the height
  963. ;                            $i_height - Specifies the height, in pixels, of the combo box component identified by $i_component
  964. ; Requirement:            None
  965. ; Return Value(s):    If the index or height is invalid, the return value is $CB_ERR
  966. ; User CallTip:        _GUICtrlComboSetItemHeight($h_combobox, $i_component, $i_height) Set the height of list items or the selection field in a combo box (required: <GuiCombo.au3>)
  967. ; Author(s):            Gary Frost (custompcs at charter dot net)
  968. ; Note(s):                $i_component parameter must be û1 to set the height of the selection field.
  969. ;                            It must be zero to set the height of list items, unless the combo box has
  970. ;                            the CBS_OWNERDRAWVARIABLE style. In that case, the $i_component parameter
  971. ;                            is the zero-based index of a specific list item
  972. ;
  973. ;===============================================================================
  974. Func _GUICtrlComboSetItemHeight($h_combobox, $i_component, $i_height)
  975.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  976.     If IsHWnd($h_combobox) Then
  977.         Return _SendMessage($h_combobox, $CB_SETITEMHEIGHT, $i_component, $i_height)
  978.     Else
  979.         Return GUICtrlSendMsg($h_combobox, $CB_SETITEMHEIGHT, $i_component, $i_height)
  980.     EndIf
  981. EndFunc   ;==>_GUICtrlComboSetItemHeight
  982.  
  983. ;===============================================================================
  984. ;
  985. ; Description:            _GUICtrlComboSetMinVisible
  986. ; Parameter(s):        $h_combobox - controlID
  987. ;                            $i_minimum - Specifies the minimum number of visible items
  988. ; Requirement:            None
  989. ; Return Value(s):    If the message is successful, the return value is TRUE.
  990. ;                            Otherwise the return value is FALSE
  991. ; User CallTip:        _GUICtrlComboSetMinVisible($h_combobox, $i_minimum) Set the minimum number of visible items in the drop-down list of a combo box (required: <GuiCombo.au3>)
  992. ; Author(s):            Gary Frost (custompcs at charter dot net)
  993. ; Note(s):                When the number of items in the drop-down list is greater than the minimum,
  994. ;                            the combo box uses a scrollbar.
  995. ;                            By default, 30 is the minimum number of visible items.
  996. ;                            This message is ignored if the combo box control has style CBS_NOINTEGRALHEIGHT.
  997. ;                            To use CB_SETMINVISIBLE, the application must specify comctl32.dll version 6 in the manifest
  998. ;
  999. ;===============================================================================
  1000. Func _GUICtrlComboSetMinVisible($h_combobox, $i_minimum)
  1001.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, False)
  1002.     If IsHWnd($h_combobox) Then
  1003.         Return _SendMessage($h_combobox, $CB_SETMINVISIBLE, $i_minimum)
  1004.     Else
  1005.         Return GUICtrlSendMsg($h_combobox, $CB_SETMINVISIBLE, $i_minimum, 0)
  1006.     EndIf
  1007. EndFunc   ;==>_GUICtrlComboSetMinVisible
  1008.  
  1009. ;===============================================================================
  1010. ;
  1011. ; Description:            _GUICtrlComboSetTopIndex
  1012. ; Parameter(s):        $h_combobox - controlID
  1013. ;                            $i_index - Specifies the zero-based index of the list item
  1014. ; Requirement:            None
  1015. ; Return Value(s):    If the message is successful, the return value is zero.
  1016. ;                            If the message fails, the return value is $CB_ERR
  1017. ; User CallTip:        _GUICtrlComboSetTopIndex($h_combobox, $i_index) Ensure that a particular item is visible (required: <GuiCombo.au3>)
  1018. ; Author(s):            Gary Frost (custompcs at charter dot net)
  1019. ; Note(s):                The system scrolls the list box contents so that either the specified
  1020. ;                            item appears at the top of the list box or the maximum scroll range
  1021. ;                            has been reached
  1022. ;
  1023. ;===============================================================================
  1024. Func _GUICtrlComboSetTopIndex($h_combobox, $i_index)
  1025.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, $CB_ERR)
  1026.     If IsHWnd($h_combobox) Then
  1027.         Return _SendMessage($h_combobox, $CB_SETTOPINDEX, $i_index)
  1028.     Else
  1029.         Return GUICtrlSendMsg($h_combobox, $CB_SETTOPINDEX, $i_index, 0)
  1030.     EndIf
  1031. EndFunc   ;==>_GUICtrlComboSetTopIndex
  1032.  
  1033. ;===============================================================================
  1034. ;
  1035. ; Description:            _GUICtrlComboShowDropDown
  1036. ; Parameter(s):        $h_combobox - controlID
  1037. ;                            $i_bool - Specifies whether the drop-down list box is to be shown or hidden
  1038. ; Requirement:            CBS_DROPDOWN or CBS_DROPDOWNLIST style
  1039. ; Return Value(s):    None
  1040. ; User CallTip:        _GUICtrlComboShowDropDown($h_combobox, $i_bool) Show or hide the list box of a combo box (required: <GuiCombo.au3>)
  1041. ; Author(s):            Gary Frost (custompcs at charter dot net)
  1042. ; Note(s):                $i_bool = TRUE shows the list box
  1043. ;                             $i_bool = FALSE hides it
  1044. ;                            This message has no effect on a combo box created with the CBS_SIMPLE style
  1045. ;
  1046. ;===============================================================================
  1047. Func _GUICtrlComboShowDropDown($h_combobox, $i_bool)
  1048.     If Not _IsClassName ($h_combobox, "ComboBox") Then Return SetError($CB_ERR, $CB_ERR, 0)
  1049.     If IsHWnd($h_combobox) Then
  1050.         _SendMessage($h_combobox, $CB_SHOWDROPDOWN, $i_bool)
  1051.     Else
  1052.         GUICtrlSendMsg($h_combobox, $CB_SHOWDROPDOWN, $i_bool, 0)
  1053.     EndIf
  1054. EndFunc   ;==>_GUICtrlComboShowDropDown